﻿@model IEnumerable<Web.Areas.Admin.Models.Manager>

@{
    ViewBag.Title = "管理员管理";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}

@section header{
    <style type="text/css">
    .gridColCheck{width:10%;}
    </style>
    <script type="text/javascript">
        $(function () {
            $("input[type='radio']").each(function () {
                $(this).click(function () {
                    $("#btnEdit").attr("href", "/Admin/Manager/Edit/" + $(this).attr("value"));
                    $("#btnDel").attr("href", "/Admin/Manager/Del/" + $(this).attr("value"));
                    $(this).parent().css('backgroundColor','gray');
                });
            });
        });
        function cusval() {
            var slt = $("input[type='radio']:checked").val();
            if (!slt) {
                alert("请选择要操作的数据！");
                return false;
            } else {
                return true;
            }
        }
        function cusDel() {
            var slt = $("input[type='radio']:checked").val();
            if (!slt) {
                alert("请选择要操作的数据！");
                return false;
            } else {
                return confirm('你确定要删除么？');
            }
        }
    </script>
}
<div class="nav">当前位置 :-> 管理员设置</div>
<div class="toolbar">
    @Html.ActionLink("添加","Add", "Manager", new { area="Admin"},null)
    @Html.ActionLink("编辑", "Edit", "Manager", new { area = "Admin" }, new { @id = "btnEdit", onclick = "return cusval()" })
    @Html.ActionLink("删除", "Del", "Manager", new { area = "Admin" }, new { @id = "btnDel", onclick = "return cusDel()" })
    @Html.ActionLink("刷新", "Index", "Manager", new { area = "Admin" }, null)
</div>
<hr />
@{var grid = new WebGrid(source:Model,defaultSort:"UserId",rowsPerPage:10);}

@grid.GetHtml(
tableStyle: "grid",
headerStyle: "head",
alternatingRowStyle: "alt",
htmlAttributes: new { width = "100%" },
columns: grid.Columns(
grid.Column(format: @<text><input type="radio" name="rdoManager" value="@item.UserId" /></text>),
    grid.Column("UserId", "编号"),
    grid.Column("Username", "用户名"),
        grid.Column("Realname", "真实姓名"),
            grid.Column("Email", "邮箱"),
                grid.Column("RoleName", "角色")
)
)

